import allure
import pytest
from selenium.webdriver.common.by import By
from base.base import Base
from utils import get_excel


class  PageLogin(Base):
    # 输入用户名
    @allure.step("1、输入用户名")
    def __page_input_username(self,username):
        self.element_send_keys((By.ID,"username"),username)
    # 输入密码
    @allure.step("2、输入密码")
    def __page_input_password(self,password):
        self.element_send_keys((By.ID,"password"),password)
    # 输入验证码
    @allure.step("3、输入验证码")
    def __page_input_code(self,code):
        self.element_send_keys((By.ID,"verify_code"),code)
    # 点击登录按钮
    @allure.step("4、点击登录按钮")
    def __page_click_login_btn(self):
        self.element_click((By.NAME,"sbtbutton"))
    # 获取错误的信息

    def page_get_error_info(self):
        return self.get_element_text((By.CSS_SELECTOR,".layui-layer-content.layui-layer-padding"))
    def page_login(self,username,password,code):
        self.__page_input_username(username) # 输入用户名
        self.__page_input_password(password) # 输入密码
        self.__page_input_code(code)  #  输入验证码
        self.__page_click_login_btn()  #  点击登录按钮



















